#This replace the loglayer from the weights trained for phoneme discrimination.
import sys
import json

def main():

    spk_ptr_file = open(sys.argv[1],'r')
    phn_ptr_file = open(sys.argv[2],'r')
    ptr_file = open(sys.argv[3],'w')

    nnet_dict_spk=json.load(spk_ptr_file)
    nnet_dict_phn=json.load(phn_ptr_file)
    dict_key = 'logreg W'
    nnet_dict_spk[dict_key]=nnet_dict_phn.get(dict_key)
    dict_key = 'logreg b'
    nnet_dict_spk[dict_key]=nnet_dict_phn.get(dict_key)
    json.dump(nnet_dict_spk, ptr_file, indent=2, sort_keys = True)

    spk_ptr_file.close()
    phn_ptr_file.close()
    ptr_file.close()




if __name__=="__main__":
    main()

